﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Furniture_Rental_System
{
    public partial class ReturnItemForm : Form
    {

        String currentLoggedInEmployeeId;

        public ReturnItemForm(String employeeId)
        {
            InitializeComponent();
            this.currentLoggedInEmployeeId = employeeId;
        }

        private void buttonReturnItem_Click(object sender, EventArgs e)
        {

            int theRentalNumber;
            if (this.textBoxRentalNumber.Text == "")
            {
                MessageBox.Show("Must enter a rental number.");
                return;
            }
            if (!Int32.TryParse(this.textBoxRentalNumber.Text, out theRentalNumber))
            {
                MessageBox.Show("Must enter a rental number.");
                return;
            }


            DataBaseAccessor returnItems = new DataBaseAccessor();
            DateTime dateAndTimeOfTransaction = System.DateTime.Now;


            returnItems.addNewCheckin(dateAndTimeOfTransaction, this.currentLoggedInEmployeeId, theRentalNumber);
            MessageBox.Show("Item has been returned");

        }



       
       
    }
}
